from django.shortcuts import render
from rest_framework.decorators import action
# Create your views here.
from rest_framework.viewsets import GenericViewSet
from buyHigh.utils.buyHighResponse import APIResponse
from .serializer import CategorySerializer
from . import models
class CategoryView(GenericViewSet):
    serializer_class =CategorySerializer
    queryset = models.Category.objects.filter(pid=None)
    @action(methods=['get'],detail=False)
    def get_category_list(self,request):
        queryset = self.get_queryset()
        serializer = self.get_serializer(queryset,many=True)
        return APIResponse(data=serializer.data,statusCode=200,message='成功',code=200)